<script setup>
import { ref } from "vue";
import SectionTitle from "../common/SectionTitle.vue";

const products = ref([
  {
    id: 1,
    title: "智能耕种机",
    description: "高效、节能、智能化的现代农业耕种机械",
    image: "product-image-1",
  },
  {
    id: 2,
    title: "自动收割机",
    description: "精准、快速的智能收割设备，提高收获效率",
    image: "product-image-2",
  },
  {
    id: 3,
    title: "智能植保机",
    description: "环保、精准的农作物保护设备，降低农药使用量",
    image: "product-image-3",
  },
]);

const productDescription =
  "我们提供全系列农业机械设备，从耕种到收获，满足不同农业生产需求";
</script>

<template>
  <section class="section products-section" id="products">
    <div class="section-container">
      <SectionTitle title="产品中心" :description="productDescription" />
      <el-row :gutter="20" class="product-list">
        <el-col
          :xs="24"
          :sm="12"
          :md="8"
          v-for="product in products"
          :key="product.id"
        >
          <div class="product-card">
            <div :class="['product-image', product.image]"></div>
            <div class="product-info">
              <h3>{{ product.title }}</h3>
              <p>{{ product.description }}</p>
              <el-button type="primary">查看详情</el-button>
            </div>
          </div>
        </el-col>
      </el-row>
      <div class="view-more">
        <el-button type="primary" plain>查看更多产品</el-button>
      </div>
    </div>
  </section>
</template>

<style scoped>
.section {
  padding: var(--section-padding);
}

.section-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

.product-list {
  margin-bottom: 30px;
}

.product-card {
  background-color: #fff;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  height: 100%;
  transition: transform 0.3s ease;
}

.product-card:hover {
  transform: translateY(-5px);
}

.product-image {
  height: 200px;
  background-size: cover;
  background-position: center;
}

.product-image-1 {
  background-image: url("https://images.unsplash.com/photo-1586771107445-d3ca888129ce?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1472&q=80");
}

.product-image-2 {
  background-image: url("https://images.unsplash.com/photo-1625243338629-28c3f5b7ea55?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80");
}

.product-image-3 {
  background-image: url("https://images.unsplash.com/photo-1621628898826-8956e10449eb?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80");
}

.product-info {
  padding: 20px;
}

.product-info h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

.product-info p {
  margin-bottom: 15px;
  color: var(--text-color-light);
  font-size: 14px;
}

.view-more {
  text-align: center;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .section {
    padding: 60px 0;
  }

  .product-image {
    height: 180px;
  }
}

@media (max-width: 576px) {
  .section {
    padding: 40px 0;
  }

  .product-image {
    height: 160px;
  }
}
</style> 